import { TableConfigInit } from '@/shared/class'
import { ElImage } from 'element-plus'
import { UserInfoClass } from './controller'
import { h } from 'vue'

export class ConfigClass {
	config = new TableConfigInit()
	userInfoClass: UserInfoClass
	constructor(userInfoClass: UserInfoClass) {
		this.userInfoClass = userInfoClass
	}
	public tableConfig = {
		...this.config.getDefaultConfig(),
		columns: [
			{
				label: '标题',
				key: 'title'
			},
			{
				label: '内容',
				key: 'content'
			},
			{
				label: '封面',
				key: 'img',
				slotComponent: scope => {
					return h(ElImage, {
						loading: 'lazy',
						previewTeleported: true,
						previewSrcList: [`http://ikun-pro-ui.fun:3000/static/${scope.row.img}`],
						fit: 'cover',
						src: `http://ikun-pro-ui.fun:3000/static/${scope.row.img}`,
						style: { width: '100px', height: '40px' }
					})
				}
			}
		]
	}
}
